Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use more use statements #250

Merged
merged 2 commits into from
Jul 10, 2024
Merged

Use more use statements #250

merged 2 commits into from
Jul 10, 2024

Conversation

briskt
Copy link
Contributor

@briskt briskt commented Jul 10, 2024

Fixed

  • Added use statements to import classes
  • Removed unnecessary use statements

Copy link


if (!$config->getOptionalBoolean('enable.saml20-idp', false)) {
throw new \SimpleSAML\Error\Error('NOACCESS');
throw new Error\Error('NOACCESS');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a use ...\Error\Error as SimpleSAML_Error?

@@ -145,7 +150,7 @@
);

if (!$idpmeta->hasValue('OrganizationURL')) {
throw new \SimpleSAML\Error\Exception('If OrganizationName is set, OrganizationURL must also be set.');
throw new Error\Exception('If OrganizationName is set, OrganizationURL must also be set.');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, but use ... as SimpleSAML_Exception?

@@ -224,5 +229,5 @@
exit(0);
}
} catch (Exception $exception) {
throw new \SimpleSAML\Error\Error('METADATA', $exception);
throw new Error\Error('METADATA', $exception);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the less 'use' statements, but SimpleSAML_Error would be good in my opinion.

@@ -124,7 +127,7 @@ public function process(array &$state): void
$samlIDP = $state[self::IDP_KEY];

if (empty($state[self::SP_NAMEID_ATTR])) {
\SimpleSAML\Logger::warning(
Logger::warning(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"use ... as SS_Logger" would help distinguish the Logger, given the multitude of Logger's out there.


$idpEntry = $idpEntries[$samlIDP];

// The IDP metadata must have an IDPNamespace entry
if (!isset($idpEntry[self::IDP_CODE_KEY])) {
throw new \SimpleSAML\Error\Exception(self::ERROR_PREFIX . "Missing required metadata entry: " .
throw new Error\Exception(self::ERROR_PREFIX . "Missing required metadata entry: " .

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already commented about the Error\something above multiple times. Not going to comment on each one.

@@ -17,7 +20,7 @@ class TrackIdps extends \SimpleSAML\Auth\ProcessingFilter
public function process(array &$state): void
{
// get the authenticating Idp and add it to the list of previous ones
$session = \SimpleSAML\Session::getSessionFromRequest();
$session = Session::getSessionFromRequest();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about Session... perhaps a "use ... as SS_Session" might be useful, given there is a Yii session object.

Copy link

@mtompset mtompset left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comments are suggestions, not necessarily forced request for changes. This is already a nice improvement.

@briskt
Copy link
Contributor Author

briskt commented Jul 10, 2024

@mtompset thanks for the alias suggestions. They might be a next step if/when things get messy or confusing.

@briskt briskt merged commit 43655a4 into develop Jul 10, 2024
3 checks passed
@briskt briskt deleted the feature/use-use branch July 10, 2024 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants